- if @merge_request.has_ci?
  .mr-widget-heading
    .ci_widget.ci-success{style: "display:none"}
      = icon("check")
      %span CI build passed
      for #{@merge_request.last_commit_short_sha}.
      = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink"

    .ci_widget.ci-failed{style: "display:none"}
      = icon("times")
      %span CI build failed
      for #{@merge_request.last_commit_short_sha}.
      = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink"

    - [:running, :pending].each do |status|
      .ci_widget{class: "ci-#{status}", style: "display:none"}
        = icon("clock-o")
        %span CI build #{status}
        for #{@merge_request.last_commit_short_sha}.
        = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink"

    .ci_widget
      = icon("spinner spin")
      Checking for CI status for #{@merge_request.last_commit_short_sha}

    .ci_widget.ci-not_found{style: "display:none"}
      = icon("times")
      %span Can not find commit in the CI server
      for #{@merge_request.last_commit_short_sha}.
      

    .ci_widget.ci-canceled{style: "display:none"}
      = icon("times")
      %span CI build canceled
      for #{@merge_request.last_commit_short_sha}.
      = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink"

    .ci_widget.ci-error{style: "display:none"}
      = icon("times")
      %span Cannot connect to the CI server. Please check your settings and try again.

  :coffeescript
    $ ->
      merge_request_widget.getCiStatus()
